﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Xml;
using System.IO;
using Cheetah_Fast_Banking_App;

namespace CFBA_Unit_Test
{
    [TestClass]
    public abstract class DataTestBase
    {
        protected string testDataPath = "CFBA Test Data.xml";
        
        [TestInitialize]
        public void ResetDataSource()
        {
            DataSourceSingleton.GetInstance().SetDataSource(testDataPath);
        }

        protected void SetupTestModData(string testInstanceFileName)
        {
            //setup some valid data
            XmlDocument doc = new XmlDocument();
            doc.Load(testDataPath);
            string testModDataPath = Path.Combine(Environment.CurrentDirectory, testInstanceFileName);
            doc.Save(testModDataPath);
            DataSourceSingleton.GetInstance().SetDataSource(testModDataPath);
        }
    }
}
